<?xml version="1.0" encoding="UTF-8"?>

<!--
    Document   : Users.xsl
    Created on : July 1, 2012, 7:00 AM
    Author     : ThanhTai
    Description:
        Purpose of transformation follows.
-->

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="html"/>

    <!-- TODO customize transformation rules 
         syntax recommendation http://www.w3.org/TR/xslt 
    -->
    <xsl:template match="/">
        <table border="1" id="tableA">
            <thead>
                <tr>
                    <th>Select</th>
                    <th>No.</th>
                    <th>User Name</th>
                    <th>Password</th>
                    <th>FullName</th>
                    <th>Roles</th>
                </tr>
            </thead>
            <tbody>
                <xsl:apply-templates select="users"/>
            </tbody>
        </table>
    </xsl:template>

    <xsl:template match="users">
        <xsl:apply-templates select="user"></xsl:apply-templates>
    </xsl:template>

    <xsl:template match="user">
        <form>
            <xsl:attribute name="id">
                <xsl:text>ChooseStaffForm</xsl:text>
            </xsl:attribute>
            <tr>
                <td>
                    <select>
                        <xsl:attribute name="id">
                            <xsl:text>ChooseStaff</xsl:text>
                        </xsl:attribute>
                        <xsl:attribute name="size">
                            <xsl:text>1</xsl:text>
                        </xsl:attribute>
                        <option id="Check">Check</option>
                        <option id="Uncheck" selected="true">Uncheck</option>
                    </select>
                </td>
                <td>
                    <xsl:number level="single" count="user"/>
                </td>
                <td>
                    <xsl:value-of select="username"/>
                    <xsl:element name="input">
                        <xsl:attribute name="type">
                            <xsl:text>hidden</xsl:text>
                        </xsl:attribute>
                        <xsl:attribute name="name">
                            <xsl:text>username</xsl:text>
                        </xsl:attribute>
                        <xsl:attribute name="value">
                            <xsl:value-of select="username"/>
                        </xsl:attribute>
                    </xsl:element>
                </td>
                <td>
                    *****
                </td>
                <td>
                    <xsl:value-of select="fullName"/>
                </td>
                <td>
                    <xsl:value-of select="userRole"/>
                </td>
            </tr>
        </form>
    </xsl:template>
</xsl:stylesheet>